﻿//===========================[ 8 / 16 / 2011 LVI ]=============================
//				Copyright c Vitaly Lyaschenko <SkyChameleon@gmail.com>
// 								Header file
// Purpose: выводит отладочную геометрию
//=============================================================================
#pragma once

#include "cCreateGeometry.h"
#include "cRenderDevice.h"
#include "cEffect.h"

class IBaseGeometry
{
public:
	virtual void init( cEffect *pEffect ) = 0;
	virtual void draw() = 0;

	virtual ~IBaseGeometry(){}

	mat4 &modelMtr()
	{
		return mtrModel;
	}

protected:
	cRenderDevice *m_pRender;
	cEffect *m_pEffect;
	mat4 mtrModel;
};

class dbgGrid : public IBaseGeometry
{
public:
	dbgGrid( int sizeX, int sizeY, float stride );
	~dbgGrid();

	void init( cEffect *pEffect );
	void draw();

private:
	mat4 mtrModel;
	int coutVertex;

	cVAO *m_VAO;
	cVBO *m_VBO_Pos;
	std::vector<vec3> vertex;
};

class CoorGrid : public IBaseGeometry
{
public:
	CoorGrid( int sizeX, int sizeY, float stride );
	~CoorGrid();

	void init( cEffect *pEffect );
	void draw();

private:
	
	int coutVertex;

	cVAO *m_VAO;
	cVBO *m_VBO_Pos;
	cVBO *m_VBO_Color;
	std::vector<Vertex_pc> vertex;
};

class Box : public IBaseGeometry
{
public:
	Box( int size );
	~Box();

	void init( cEffect *pEffect );
	void draw();

private:
	mat4 mtrModel;
	int coutIndex;
	int coutVert;

	cVAO *m_VAO;
	cVBO *m_VBO_Pos;
	cVBO *m_VBO_Normal;
	cVBO *m_VBO_TexCoor;
	cVBO *m_VBO_Indices;

	std::vector<Vertex_PNT> vertex;
	std::vector<_16ubit> index;
};
